@echo off

@REM 设置要监控的应用名称
set app_name="com.example.navigationdemo"

@REM 获取应用pid
for /F %%i in ('hdc shell pidof %app_name%') do ( set app_pid=%%i)
echo "the name and pid of the checked app are: [%app_name%, %app_pid%]."

hdc shell mount -o rw,remount /
hdc shell "hidumper --mem %app_pid% | head -6 | tail -3 && sleep 1"
:loop
    call:exec_op
    hdc shell "hidumper --mem %app_pid% | grep -E 'ark|native' && sleep 1"
goto loop

:exec_op
    hdc shell "uinput -T -c 398 346 100 > /dev/null && sleep 1"
    hdc shell "uinput -T -c 60 106 100 > /dev/null && sleep 1"
goto:eof
